#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int x;
	scanf("%d",&x);
	if(x<0){
		printf("%.2lf\n",fabs(x));
	}else if(x<2){
		printf("%.2lf\n",pow(x+1,0.5));
	}else if(x<4){
		printf("%.2lf\n",pow(x+2,2));
	}else{
		printf("%.2lf\n",2.0*x+5);
	}
	return 0;
}
